package com.zl.cms.controller;

import com.zl.basic.model.Captcha;
import com.zl.cms.auth.AuthClass;
import com.zl.cms.auth.AuthMethod;
import com.zl.cms.model.Role;
import com.zl.cms.model.RoleType;
import com.zl.cms.model.User;
import com.zl.cms.service.IUserService;
import com.zl.cms.web.CmsSessionContext;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.imageio.ImageIO;
import javax.inject.Inject;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;

/**
 * User: zl email:c3tc3tc3t@126.com Date: 14-1-19 Time: 下午12:01
 */
@Controller
@AuthClass("login")
public class AdminController {

  @RequestMapping("/admin")
  @AuthMethod
  public String index() {
    return "admin/index";
  }

  @AuthMethod
  @RequestMapping("/admin/logout")
  public String logout(HttpSession session) {
    CmsSessionContext.removeSession(session);
    System.out.println("移除了Session " + session.getId());
    session.invalidate();
    return "redirect:/login";
  }



}
